<?php 
header("content-type:text/html;charset=utf8");
//接值
$u_name=$_POST["u_name"];
$u_pwd=$_POST["u_pwd"];
//连选库
$db=new PDO("mysql:host=127.0.0.1;dbname=bj07c;charset=utf8","root","root");
$sql="select * from yh where u_name='$u_name' and u_pwd=$u_pwd";
$res=$db->query($sql)->fetchAll(PDO::FETCH_ASSOC);
if($res)
{
  $arr=array("code"=>1,"msg"=>"登录成功");
}
else
{
 $arr=array("code"=>2,"msg"=>"登录失败");
}
echo json_encode($arr);
 ?>
